<?php
abstract class NoBusinessBase_Merchant_Gateway_Abstract
{
    protected $_firstName;
    protected $_lastName;
    protected $_creditCardType;
    protected $_creditCardNumber;
    protected $_expDateMonth;
    protected $_expDateYear;

    protected $_cvv2Number;
    protected $_address1;
    protected $_address2;
    protected $_city;
    protected $_state;
    protected $_zip;
    protected $_amount;

    protected $_currencyCode;

    public function __construct($total, $formInfo)
    {
       $this->_currencyCode      = "USD";
       $this->_creditCardType    = $formInfo['cc_type'];
       $this->_creditCardNumber  = $formInfo['cc_number'];
       $this->_cvv2Number        = $formInfo['cc_cvv'];
       $this->_firstName         = $formInfo['billingNameFirst'];
       $this->_lastName          = $formInfo['billingNameLast'];
       $this->_address1          = $formInfo['billingAddress1'];
       $this->_address2          = $formInfo['billingAddress2'];
       $this->_city              = $formInfo['billingCity'];
       $this->_state             = $formInfo['billingState'];
       $this->_zip               = $formInfo['billingZip'];

       $this->parseDate($formInfo['cc_exp_month'] . "/" . $formInfo['cc_exp_year']);
       $this->setAmount($total);
   }
   
   public function parseDate($expDate)
   {
      // assume "mm/yy"

      $arr            = explode("/", $expDate);
      if(count($arr) != 2)
         return false;

      $this->_expDateMonth     = $arr[0];
      $this->_expDateYear      = $arr[1];

      return true;
   }

   abstract public function executePayment();

   // Setters

   public function setAmount($amount)
   {
      $this->_amount = number_format($amount, 2);
   }
}

